package routers

import (
	"MissFru/controllers/course"
	"MissFru/controllers/magzine"
	"MissFru/controllers/recipe"
	"MissFru/controllers/shop"
	"MissFru/controllers/user"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/plugins/cors"
)

func init() {
	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins:  true,
		AllowMethods:     []string{"*"},
		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin"},
		ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin"},
		AllowCredentials: true,
	}))

	//菜谱集合
	beego.Router("/recipecollection", &recipe.RecipecollectionController{})
	//菜谱详情
	beego.Router("/recipedetail", &recipe.RecipedetailController{})
	//菜谱列表
	beego.Router("/recipelist", &recipe.RecipelistController{})
	//菜谱今日吃什么
	beego.Router("/reciperandom", &recipe.ReciperandomController{})
	//菜谱搜索
	beego.Router("/recipesearch", &recipe.RecipesearchController{})

	//杂志列表
	beego.Router("/magzine", &magzine.MagzineController{})
	//杂志详情
	beego.Router("/magzinedetail", &magzine.MagzinedetailController{})

	//商品列表
	beego.Router("/productsearch", &shop.ProductsearchController{})

	//课程列表
	beego.Router("/course", &course.CourseController{})

	//登录注册忘记密码
	beego.Router("/login", &user.LoginController{})
	//个人信息
	beego.Router("/personinfo", &user.PersoninfoController{})
	//头像管理
	beego.Router("/headicon", &user.HeadiconController{})
	//作品管理
	beego.Router("/recipemanage", &user.RecipeManageController{})

}
